package com.dou.yygh.hosp.controller;

import com.dou.yygh.common.result.Result;
import com.dou.yygh.hosp.service.HospitalService;
import com.dou.yygh.model.hosp.Hospital;
import com.dou.yygh.vo.hosp.HospitalQueryVo;
import com.dou.yygh.vo.hosp.HospitalSetQueryVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA 2021.1 x64
 *
 * @Author: 窦义超
 * @Date: 2021/08/2021/8/29/14:08
 * @Description:
 */
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalController {
    @Autowired
    HospitalService hospitalService;
    //医院列表(条件查询)
    @GetMapping("list/{page}/{limit}")
    public Result listHosp(@PathVariable Integer page, @PathVariable Integer limit, HospitalQueryVo hospitalQueryVo){
     Page<Hospital> pageModel=   hospitalService.selectHospPage(page,limit,hospitalQueryVo);
     return Result.ok(pageModel);
    }
    //更新医院上线状态
    @ApiOperation(value = "更新医院上线状态")
    @GetMapping("updateHospStatus/{id}/{status}")
    public Result updateHospStatus(@PathVariable String id,@PathVariable Integer status){
        hospitalService.updateStatus(id,status);
        return Result.ok();
    }
    //医院详情信息
    @ApiOperation(value="医院详情信息")
    @GetMapping("showHospDetail/{id}")
    public Result showHospDetail(@PathVariable String id){
      Map<String, Object> map= hospitalService.getHospById(id);
    return Result.ok(map);
    }
}
